<?php

namespace App\Admin\Actions\Season;

use App\Admin\Renders\PreviewPosterRender;
use App\Models\Season;
use Dcat\Admin\Grid\Tools\AbstractTool;
use Dcat\Admin\Widgets\Modal;
use Throwable;

class PosterPreview extends AbstractTool
{
    protected string $title = '海报预览';

    protected string $style = 'btn btn-success';

    public function __construct(protected Season $season)
    {
        parent::__construct();
    }

    /**
     * @throws Throwable
     */
    public function render(): string
    {
        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body(PreviewPosterRender::make()->payload(['season_id' => $this->season->getKey()]))
            ->button('<button class="btn btn-outline-success waves-effect">'.$this->title.'</button>')
            ->render();
    }
}
